package com.help.help.service.impl;

import io.netty.util.internal.StringUtil;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import com.help.help.dao.CateDao;
import com.help.help.entity.CateEntity;
import com.help.help.service.CateService;


@Service("cateService")
public class CateServiceImpl extends ServiceImpl<CateDao, CateEntity> implements CateService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<CateEntity> wrapper = new QueryWrapper<>();
        Object key = params.get("key");
        if(!StringUtil.isNullOrEmpty(key.toString())){
            wrapper.eq("name",key);
        }
        IPage<CateEntity> page = this.page(
                new Query<CateEntity>().getPage(params),
              wrapper
        );

        return new PageUtils(page);
    }

}